package InterIterator;

/**
 * Created by sunwei on 2017/10/12
 * Time:9:54
 */
public class LinkList {
    private Link first;
    /*
    构造方法
     */
    public LinkList() {
        first = null;
    }
    /*
    First的get方法
     */
    public Link getFirst() {
        return first;
    }
    /*
    First的set方法
     */
    public void setFirst(Link first) {
        this.first = first;
    }

    /*
    判空
     */
    public boolean isEmpty(){
        return (first==null);
    }

    /*
    获取每个节点所对应的迭代对象引用
     */
    public ListIterator getIterator(){
        return new ListIterator(this);
    }

    /*
    遍历显示节点
    */
    public void displayList(){
        Link current = first;
        while (current!=null){
            current.displayLink();
            current = current.next;
        }
        System.out.println(" ");
    }

}
